<!DOCTYPE HTML>
<html>
	<head>
		<title>SOAP-Test with persistence-layer</title>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
		<meta name="script" http-equiv="Content-Script-Type" content="text/javascript" />
		<meta name="script" http-equiv="Content-Style-Type" content="text/css" />
		<meta http-equiv="Access-Control-Allow-Origin" content="*">
		<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
		<script src="../business/services/soap_service.js" type="text/javascript"></script>
        <script src="../persistence/persistence.js" type="text/javascript"></script>
        <script src="../business/business_objects/group.js" type="text/javascript"></script>
        <script src="../business/business_objects/match.js" type="text/javascript"></script>
        <script src="../business/business_objects/group.js" type="text/javascript"></script>
		<script>
			function testPersistence() {
                var persistence = new Persistence();

                // mockup01
                var groups = persistence.getallGroupsForWM2014();
                $.each(groups, function(key, value) {
                    alert("groupId=" + this.getGroupId() + ", groupName=" + this.getGroupName());
                });

                // mockup02 -> TODO: does not return to test class
                /*var matches = persistence.getAllMatchesForSelectedDate('2014-06-12');
                $.each(matches, function(key, value) {
                    console.log("matchId=" + this.getId() + ", startDateTime=" + this.getStartDateTime() + ", team1=" + this.getTeam1()
                         + ", team2" + this.getTeam2() + ", team1-score=" + this.getTeam1Points() + ", team2-score=" + this.getTeam2Points());
                });
                
                */

                // mockup03 - is the query correct with groupOrderId?


                // mockup04 -> TODO: foreach skips return!!!
                var match = persistence.getMatchByMatchId(27396);
                alert("matchId=" + match.getId() + ", team1=" + match.getTeam1() + ", team2=" + match.getTeam2()
                    + ", team1-score=" + match.getTeam1Points() + ", team2-score=" + match.getTeam2Points());

                var goals = match.getGoals();
                for (var goal in goals) {
                    alert("goalId=" + goal.getId() + ", matchId=" + goal.getMatchId() + ", goalMatchMinute=" + goal.getGoalMatchMinute() + ", team1-score="
                        + goal.getTeam1Points() + ", team2-score=" + goal.getTeam2Points() + ", goalGetter=" + goal.getGoalGetterName() + ", goalPenalty="
                        + goal.isGoalPenalty() + ", ownGoal=" + goal.isOwnGoal() + ", overtime=" + goal.isOvertime() + ", comment=" + goal.getGoalComment());
                }
			}
		</script>
	</head>
	<body>
		<button onclick="testPersistence()">send Request to Persistence</button>
	</body>
</html>